<?php 
if (!empty($this->flash_messages))
{
    foreach ($this->flash_messages as $flash_message)
    {
        echo '<div class="message">'.$flash_message.'</div>';
    }
}
?>

<?php if (!empty($this->nodes)) : ?>
    <?php foreach ($this->nodes as $node) : ?>
        <div class="node-item node-view">
            <?php if (Zend_Registry::get('user')->canManage()) : ?>
            <div class="node-links">
                <a href="<?php echo $this->fixUrl('node/edit/'.$node->id) ?>"><?php echo Zend_Registry::get('locale')->_('Edit') ?></a>
                &nbsp;|&nbsp;
                <a class="delete" href="javascript:if(confirm('<?php echo Zend_Registry::get('locale')->_('Are you sure ?')?>')){window.location.href='<?php echo $this->fixUrl('node/delete/'.$node->id) ?>'}"><?php echo Zend_Registry::get('locale')->_('Delete') ?></a>
            </div>
            <?php endif; ?>
            <h1><?php echo htmlspecialchars($node->title) ?></h1>
            <p><?php echo $node ?></p>
            <em class="date">
                <?php echo Zend_Registry::get('locale')->_('Date').': '?>
                <?php echo date('d.m.Y',strtotime($node->publish_date)) ?>
            </em>
            <div class="node-author">
                <?php echo Zend_Registry::get('locale')->_('Author').': '?>
                <?php if (Zend_Registry::get('user')->canView(new Application_Model_UserResources(Application_Model_User::RESOURCE_NAME))) : ?>
                    <a href="<?php echo $this->fixUrl('user/view/'.$node->uid) ?>"><?php echo $this->authors[$node->uid] ?></a>
                <?php else : ?>
                    <span><?php echo $this->authors[$node->uid] ?></span>
                <?php endif; ?>
            </div>
        </div>
        <div class="related-nodes">
            <?php echo $this->related($node->id); ?>
        </div>
    <?php endforeach; ?>
<?php endif; ?>
